<template>
	<view>
		<form>
			<view class="cu-form-group">
				<view class="title">account</view>
				<input name="input" v-model="register_code"></input>
			</view>
			<view class="padding flex flex-direction">
				<button class="cu-btn bg-grey lg" @click="save">添加</button>
			</view>
		</form>
	</view>
</template>

<script>
	import { addAdminer } from '../../api/system.js';
	export default {
		data() {
			return {
				register_code:'',
			};
		},
		methods: {
			save() {
				if (this.register_code.trim() === '') {
					uni.showToast({ title: '请填写账号', icon: 'none' });
					return
				}
				var data = {
					register_code: this.register_code,
				}
				addAdminer(data).then(res => {
					if (res.ok != undefined) {
						uni.showToast({ title: '添加成功', icon: 'none' });
					} else {
						uni.showToast({ title: res.msg, icon: 'none' });
					}
					
				}).catch(err => {
					uni.showToast({ title: '添加失败', icon: 'none' });
				});
			}
		}
	}
</script>

<style>

</style>
